/**
 * @file World.cpp
 * @author  Aljosa Osep <aljosa.osep@gmail.com>
 * @version 1.0
 *
 * @section LICENSE
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details at
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @section DESCRIPTION
 *
 * The game world class implementation.
 */
#include "World.h"

namespace xEngine
{
    namespace CoreSystem
    {
        // Default constructor
        World::World() {
            // TODO
        }

        // Destructor
        World::~World() {
            // TODO
        }

        void World::init() {
            this->objectsHashTable = new SymTable<SceneNode*>(); // Create hash table
        }


        void World::shutDown() {

            // Release SceneNode data
            SceneNode::release();
            
            // Delete object hash table, if present
            if ( this->objectsHashTable != NULL ) {
                delete this->objectsHashTable;
                this->objectsHashTable = NULL;
            }

        }

        SceneNode* World::getObject(string name) {
           /* map<string, SceneNode*>::iterator it; // Iterator

            it = this->objectsHashTable->find(name); // Find objects asociated with this name

            if ( it != this->objectsHashTable->end() )
                return (*it).second; // Object found - return it (pointer to obj)

            return NULL; // Object not found :(*/

            return this->objectsHashTable->getSymValue(name);
        }

        void World::insertToObjects(SceneNode *node) {
            //this->objectsHashTable->insert(pair<string, SceneNode*>(node->name, node));
            this->objectsHashTable->insertSym(node->name, node);
        }

 /*       void World::draw() {

        }

        void World::update() {

        }

        void World::animate() {

        }*/
    }
}

